//
//  CTMediator+OldBarGun.m
//  KBMediator_Catrgories
//
//  Created by 肖雄 on 17/5/2.
//  Copyright © 2017年 kuaibao. All rights reserved.
//

#import "CTMediator+OldBarGun.h"

@implementation CTMediator (OldBarGun)

- (UINavigationController *)OldBarGun_fatherNavigationControllerWithRootViewContolller:(UIViewController *)controller
{
    NSDictionary *params = nil;
    if (controller) {
        params = @{@"root": controller};
    }

    return [self performTarget:@"OldBarGun" action:@"fatherNavController" params:params shouldCacheTarget:YES];
}

- (UINavigationController *)OldBarGun_csCaptureWithMaxCount:(NSInteger)maxCount titles:(NSArray<NSString *> *)titles immediateDismiss:(BOOL)immediateDismiss applyToAll:(BOOL)applyToAll completionHandle:(void (^)(NSArray<UIImage *> * _Nullable))completionHandle applyToAllHandle:(void (^)(UIImage * _Nullable))applyToAllHandle
{
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    [params setObject:@(maxCount) forKey:@"maxCount"];
    [params setObject:@(immediateDismiss) forKey:@"immediateDismiss"];
    [params setObject:@(applyToAll) forKey:@"applyToAll"];
    if (titles) [params setObject:titles forKey:@"titles"];
    if (completionHandle) [params setObject:[completionHandle copy] forKey:@"completionHandle"];
    if (applyToAllHandle) [params setObject:[applyToAllHandle copy] forKey:@"applyToAllHandle"];
    
    return [self performTarget:@"OldBarGun" action:@"csCaptureController" params:params shouldCacheTarget:YES];
}

- (UIViewController *)OldBarGun_csCaptureWithBrand:(NSString *)brand maxCount:(NSInteger)maxCount titles:(NSArray<NSString *> *)titles immediateDismiss:(BOOL)immediateDismiss applyToAll:(BOOL)applyToAll completionHandle:(void (^)(NSArray<UIImage *> * _Nullable))completionHandle applyToAllHandle:(void (^)(UIImage * _Nullable))applyToAllHandle
{
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    [params setObject:@(maxCount) forKey:@"maxCount"];
    [params setObject:@(immediateDismiss) forKey:@"immediateDismiss"];
    [params setObject:@(applyToAll) forKey:@"applyToAll"];
    if (brand) [params setObject:brand forKey:@"brand"];
    if (titles) [params setObject:titles forKey:@"titles"];
    if (completionHandle) [params setObject:[completionHandle copy] forKey:@"completionHandle"];
    if (applyToAllHandle) [params setObject:[applyToAllHandle copy] forKey:@"applyToAllHandle"];
    
    return [self performTarget:@"OldBarGun" action:@"csCaptureController" params:params shouldCacheTarget:YES];
}

- (UIViewController *)OldBarGun_troubleEvidenceControllerWithType:(NSInteger)type selectObjects:(NSArray *)selectObjects backCon:(UIViewController *)backCon
{
    NSDictionary *params = @{@"type": @(type),
                             @"selectObjects": selectObjects ?: @[],
                             @"backCon": backCon};
    
    return [self performTarget:@"OldBarGun" action:@"troubleEvidenceController" params:params shouldCacheTarget:YES];
}

- (UIViewController *)OldBarGun_recordOrdersControllerWithSelectObjects:(NSArray *)selectObjects
{
    NSDictionary *params = @{@"selectObjects": selectObjects ?: @[]};
    
    return [self performTarget:@"OldBarGun" action:@"recordOrdersController" params:params shouldCacheTarget:YES];
}

- (UIViewController *)OldBarGun_scanControllerForThreeCodeWithCompletionHandle:(void (^)(NSString *))completionHandle
{
    NSDictionary *params = nil;
    if (completionHandle) {
        params = @{@"callBack": [completionHandle copy]};
    }
    
    return [self performTarget:@"OldBarGun" action:@"scanControllerForThreeCode" params:params shouldCacheTarget:YES];
}

- (UIViewController *)OldBarGun_inventControllerWithBackCon:(UIViewController *)backCon
{
    NSDictionary *params = nil;
    if (backCon) {
        params = @{@"backCon": backCon};
    }

    return [self performTarget:@"OldBarGun" action:@"inventController" params:params shouldCacheTarget:YES];
}

- (UIViewController *)OldBarGun_webViewControllerWithTitle:(NSString *)title URLString:(NSString *)URLString
{
    NSDictionary *params = @{@"title": title ?: @"",
                             @"URLString": URLString ?: @""};

    return [self performTarget:@"OldBarGun" action:@"webViewController" params:params shouldCacheTarget:YES];
}

- (UIViewController *)OldBarGun_scanSignWithWaybillNos:(NSArray<NSString *> *)waybillNos backCon:(UIViewController *)backCon
{
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    if (waybillNos) [params setObject:waybillNos forKey:@"waybillNos"];
    if (backCon) [params setObject:backCon forKey:@"backCon"];

    return [self performTarget:@"OldBarGun" action:@"scanSignController" params:params shouldCacheTarget:YES];
}

- (UIViewController *)OldBarGun_markLabelWithWaybillNo:(NSString *)waybillNo name:(NSString *)name mobile:(NSString *)mobile address:(NSString *)address excludedLabels:(NSArray *)excludedLabels
{
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    if (waybillNo) [params setObject:waybillNo forKey:@"waybillNo"];
    if (name) [params setObject:name forKey:@"name"];
    if (mobile) [params setObject:mobile forKey:@"mobile"];
    if (address) [params setObject:address forKey:@"address"];
    if (excludedLabels) [params setObject:excludedLabels forKey:@"excludedLabels"];

    return [self performTarget:@"OldBarGun" action:@"markLabelController" params:params shouldCacheTarget:YES];
}

- (UIViewController *)OldBarGun_dialController
{
    return [self performTarget:@"OldBarGun" action:@"dailController" params:nil shouldCacheTarget:YES];
}

- (UIViewController *)OldBarGun_packageMapControllerWithData:(NSArray *)data delegate:(id)delegate
{
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    if (data) [params setObject:data forKey:@"data"];
    if (delegate) [params setObject:delegate forKey:@"delegate"];
    
    return [self performTarget:@"OldBarGun" action:@"packageMapController" params:params shouldCacheTarget:YES];
}

- (UIViewController *)OldBarGun_dispatchPackagesControllerWithDdata:(NSArray *)data
{
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    if (data) [params setObject:data forKey:@"data"];
    
    return [self performTarget:@"OldBarGun" action:@"dispatchPackagesController" params:params shouldCacheTarget:YES];
}

- (UIViewController *)OldBarGun_deliverySearchControllerWithDelegate:(id)delegate
{
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    if (delegate) [params setObject:delegate forKey:@"delegate"];

    return [self performTarget:@"OldBarGun" action:@"deliverySearchController" params:params shouldCacheTarget:YES];
}

- (UIViewController *)OldBarGun_undeliveredControllerWithItems:(NSArray *)items removeItemBlock:(id)removeItemBlock backCon:(UIViewController *)backCon
{
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    if (items) [params setObject:items forKey:@"data"];
    if (removeItemBlock) [params setObject:removeItemBlock forKey:[removeItemBlock copy]];
    if (backCon) [params setObject:backCon forKey:@"backCon"];
    
    return [self performTarget:@"OldBarGun" action:@"undeliveredController" params:params shouldCacheTarget:YES];
}

- (UIViewController *)OldBarGun_e3ScanSequenceControllerWithE3Type:(NSInteger)e3Type backCon:(UIViewController *)backCon
{
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    [params setObject:@(e3Type) forKey:@"e3Type"];
    if (backCon) { [params setObject:backCon forKey:@"backCon"]; }

    return [self performTarget:@"OldBarGun" action:@"e3ScanSequenceController" params:params shouldCacheTarget:YES];
}

- (UIViewController *)OldBarGun_troubleEnrollControllerWithImage:(UIImage *)image
{
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    if (image) { [params setObject:image forKey:@"image"]; }
    
    return [self performTarget:@"OldBarGun" action:@"troubleEnrollController" params:params shouldCacheTarget:YES];
}

- (UIViewController *)OldBarGun_e3Upload1Controller
{
    return [self performTarget:@"OldBarGun" action:@"e3Upload1Controller" params:nil shouldCacheTarget:YES];
}

- (UIViewController *)OldBarGun_ztLoginControllerWithBranchNo:(NSString *)branchNo callBack:(void (^)(BOOL))callBack
{
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    if (branchNo) { [params setObject:branchNo forKey:@"branchNo"]; }
    if (callBack) { [params setObject:[callBack copy] forKey:@"callBack"]; }

    return [self performTarget:@"OldBarGun" action:@"ztLoginController" params:params shouldCacheTarget:YES];
}


@end
